<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
 <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
	<div id="admin_search">
					<form action="adminIndex" method="post">
						主题:<select name="newsinfo.topic.id">
							<s:iterator id="var_topic" value="#request.topicList">
								<option value="${var_topic.id }">${var_topic.name }</option>
							</s:iterator>
							</select>
							新闻标题:<input type="text" name="newsinfo.title"/>
							<input type="submit" value="查询"/>
					</form>
					
				</div>
				
				<div id="admin_newsList">
					
					<s:if test="#request.newsList != null && #request.newsList.size() > 0">
						
							<s:iterator id="var_news" value="#request.newsList">
								
									 <div class="admin_newsList_div">
										<div class="admin_newsList_title">${var_news.title }</div>
										<div class="admin_newsList_author">
											<div class="admin_newsList_author_1">作者:${var_news.author }</div>
											<div class="admin_newsList_author_2"><input type="button" value="修改" onclick="update_news(${var_news.id})" /></div>
											<div class="admin_newsList_author_2"><input type="button" value="删除" onclick="delete_news(${var_news.id})"/></div>
										</div> 
									</div>
								
							</s:iterator>
						
						
						<div id="show_page">
					<ul>
						<s:if test="pager.curPage > 1">
							<li> <a href="adminIndex?pager.curPage=1&newsinfo.topic.id=${requestScope.newsinfo.topic.id }">首页</a> </li>
							<li><a href="adminIndex?pager.curPage=${pager.curPage - 1}&newsinfo.topic.id=${requestScope.newsinfo.topic.id }">上一页</a></li>
						</s:if>
						
						<s:if test="pager.curPage < pager.pageCount">
				 			<li><a href="adminIndex?pager.curPage=${pager.curPage + 1 }&newsinfo.topic.id=${requestScope.newsinfo.topic.id }">下一页</a></li>
				 			<li><a href="adminIndex?pager.curPage=${pager.pageCount }&newsinfo.topic.id=${requestScope.newsinfo.topic.id }">尾页</a></li>
				 			
				 		</s:if>
				 		<li>总共${pager.curPage}/${pager.pageCount} 页</li>
				 		<li>
				 		  <form action="adminIndex" method="post">
				 		  	跳转到<select name="pager.curPage" size="1">
				 		  		<s:bean name="org.apache.struts2.util.Counter" id="counter">
				 		  			<s:param name="first" value="1"/>
				 		  			<s:param name="last" value="%{pager.pageCount}"/>
				 		  			<s:iterator>
				 		  				<option value='<s:property/>'><s:property/></option>
				 		  			</s:iterator>
				 		  		</s:bean>
				 		  	</select>
				 		  	<input type="hidden" name="newsinfo.topic.id" value="${requestScope.newsinfo.topic.id}"/>
				 		  	<input type="submit" value="跳转"/>
				 		  </form>
				 		</li>
					</ul>
					
				</div>
				
					</s:if>
					<s:else>
						<div class="no_news">抱歉，暂无新闻!</div>
					</s:else>
				</div>
</body>
</html>